This example demonstrates how you can set the location of an OLE object at Runtime using the SetOleLocation command. The example takes three different OLE objects:
It cycles through them so the RDC prints a different object each time it formats the Details section.
Option Explicit Private Sub Report_Initialize() Database.Tables(1).Location = App.Path + "\Author.mdb" End Sub Private Sub SectionDetails_Format(ByVal pFormattingInfo As Object)
Dim bmpHold As StdPicture Dim iModNum As Integer
Calculate an integer to pass in as the object name.
iModNum = cRecNum.Value Mod 3 + 1
Take an action based on the integer passed in.
Select Case iModNum
Case 1 Set bmpHold = LoadPicture(App.Path & res\SampleBitmap1.bmp")Set the height and width of the Report object equal to the actual values for the bitmap - the StdPicture object defaults to HiMetric, the Report uses twips.
Set cOLEObj.FormattedPicture = bmpHold cOLEObj.Height = bmpHold.Height * 567 / 1000 cOLEObj.Width = bmpHold.Width * 567 / 1000
Case 2 cOLEObj.SetOleLocation App.Path & "\res\SampleExcel1.xls" cOLEObj.Height = 1800 cOLEObj.Width = 5791
Case 3 cOLEObj.SetOleLocation App.Path & "\res\SampleWord1.doc" cOLEObj.Height = 322 cOLEObj.Width = 8641 End Select End Sub
Seagate Software IMG Holdings, Inc. http://www.seagatesoftware.com Support services: http://support.seagatesoftware.com |